{include file="biz/biz_header.html"} 
<script type='text/javascript'  src='{$APP_ROOT}/admin/public/kindeditor/kindeditor.js'></script>
<script type="text/javascript">
	var VAR_MODULE = "m";
	var VAR_ACTION = "a";
	var ROOT = '{$APP_ROOT}/biz.php';
	var ROOT_PATH = '{$APP_ROOT}';

</script>

<?php
$this->_var['youhuicss'][] = $this->_var['TMPL_REAL']."/css/datepicker.css";
$this->_var['youhuijs'][] = $this->_var['TMPL_REAL']."/js/jquery.ui.core.js";
$this->_var['youhuijs'][] = $this->_var['TMPL_REAL']."/js/jquery.ui.widget.js";
$this->_var['youhuijs'][] = $this->_var['TMPL_REAL']."/js/jquery.ui.datepicker.js";

?>
<link rel="stylesheet" type="text/css" href="{function name="parse_css" v="$youhuicss"}" />
<script type="text/javascript" src="{function name="parse_script" v="$youhuijs"}"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("input[name='begin_time']").datepicker({showAnim:'fadeIn'});
		$("input[name='end_time']").datepicker({showAnim:'fadeIn'});
	});
</script>

{include file="biz/biz_nav.html"}
<div class="wrap clearfix wb biz-wrap">
{include file="biz/biz_info_header.html"}
<div class="biz_index_box clearfix">

	<div class="p10 clearfix">
			<script type="text/javascript">
				$(document).ready(function(){
					load_deal_cate_type();
					$("#cate_id").bind("change",function(){
						load_deal_cate_type();
					});
					$("select[name='send_type']").bind("change",function(){
						load_sms_content();
					});
					load_sms_content();
					$("form").bind("submit",function(){
						if($.trim($(this).find("input[name='name']").val())=='')
						{
							$.showErr("请填写名称");
							return false;
						}
						if($("select[name='send_type']").val()>0)
						{
							if($("#sms_row").find("*[name='sms_content']").val()=='')
							{
								$.showErr("请填写短信内容");
								return false;
							}
						}
					});
					
					
				});
				
				function load_sms_content()
				{
					if($("select[name='send_type']").val()>0)
					{
						$("#sms_row").show();
						$(".print_row").hide();
					}
					else
					{
						$("#sms_row").hide();
						$("#sms_row").find("*[name='sms_content']").val("");
						$(".print_row").show();
					}
				}
			</script>
			<div class="blank10"></div>
			<h3 class="modify-title">
				发布优惠券
				<a href="{url x="biz" r="youhui"}">返回上一页</a>
			</h3>
			<form method="post" action="{url x="biz" r="youhui#submit_publish"}" name="biz_publish" >
					<table cellspacing="0" cellpadding="0" border="0" class="data-table">
						<tr>
							<td class="dleft">名称</td>
							<td><input type="text" value="" class="f-input" id="name" name="name" size="30" tabindex="1"></td>
						</tr>
						<tr>
							<td>类型</td>
							<td><select name="send_type">
								<option value="0">直接使用</option>
								<option value="1" selected="selected">短信下载验证</option>
								<option value="2">短信下载验证(需要填写预订信息)</option>
							</select></td>
						</tr>
						<tr>
							<td>短信内容</td>
							<td><textarea class="f-textarea" rows=5 cols=60 name="sms_content"></textarea></td>
						</tr>
						<tr>
							<td>有效期</td>
							<td><input type="text" value="" class="f-input" id="begin_time" name="begin_time" size="20" style="width:100px;" tabindex="1">
							<span>&nbsp;&nbsp;至 &nbsp;&nbsp; </span> 
							<input type="text" value="" class="f-input" id="end_time" name="end_time" size="20" style="width:100px;" tabindex="1">
							<span class="red">&nbsp;&nbsp;请填写有效的时间格式,如：2012-01-01 </span>
							</td>
						</tr>
						<tr>
							<td>支持的店面</td>
							<td>
								{foreach from=$locations item=location}
								{$location.name} <input type="checkbox" name="location_id[]" value="{$location.id}" checked="checked" />
								{/foreach}
							</td>
						</tr>
						<tr>
							<td>分类</td>
							<td><select name="cate_id" id="cate_id">
								{foreach from=$cate_list item=cate}
								<option value="{$cate.id}">{$cate.name}</option>
								{/foreach}
							</select></td>
						</tr>
						<tr id="deal_cate_type_row" style="display:none;">
							<td>子分类</td>
							<td><span></span></td>
						</td>
					
						<tr>
							<td>城市</td>
							<td><select name="city_id" id="city_id">
								{foreach from=$deal_city_list item=city}
								<option value="{$city.id}">{$city.name}</option>
								{/foreach}
							</select></td>
						</tr>
						
						<tr>
							<td>小图</td>
							<td class="no-border" style="padding-left:0">{function name="show_ke_image" v="icon"}</td>
						</tr>
						<tr class="print_row">
							<td>打印图</td>
							<td class="no-border" style="padding-left:0">
							{function name="show_ke_image" v="image"}
							</td>
						</tr>
					
						<tr>
							<td>服务条款</td>
							<td>
								<textarea class="f-textarea" rows=5 cols=60 name="brief"></textarea>
							</td>
						</tr>
						<tr>
							<td>详情</td>
							<td style="height:375px; vertical-align:top;">
								{function name="show_ke_textarea" v="descript" w="620" h="300"}
							</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td><input type="submit" value="提交" class="biz_pub_btn" /></td>
						</tr>
					</table>
			</form>
		
	</div>
	<div class="blank"></div>
</div><!--end biz_index_box-->

</div>
{include file="biz/biz_footer.html"} 